﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace K3R {
	public class Config : ConfigurationSection {
		[ConfigurationProperty("connectionStringName", IsRequired = true)]
		public string ConnectionStringName {
			get {
				return (string)base["connectionStringName"];
			}
			set {
				base["connectionStringName"] = value;
			}
		}
	}

	public static class Settings {
		private static Config _settings = (Config)ConfigurationManager.GetSection("k3r");

		public static string ConnectionString {
			get {
				string connectionString = null;

				if (_settings != null)
					connectionString = ConfigurationManager.ConnectionStrings[_settings.ConnectionStringName].ConnectionString;

				return connectionString;
			}
		}
	}
}
